package cn.theten52.demo.patterns.design.behavior.interpreter.update1;

/**
 * 表示所有操作符
 * non-terminal expression
 *
 * @author wangjin
 * @date 2021/1/6
 */
public class Operator implements Expression {
    private char operator;

    public Operator(char operator) {
        this.operator = operator;
    }

    public char getOperator() {
        return operator;
    }

    /**
     * 计算表达式
     *
     * @param context 上下文
     */
    @Override
    public void evaluate(Context context) {
        context.setOperator(operator);
    }
}
